from google.appengine.api import users
import logging
from util import get_today

def get_gae_contexts(request):
    user = users.get_current_user()
    user_name = user.nickname() if user else ''
    if user:
        user_name = ("%s (<a href=\"%s\">log out</a>)" %
                    (user.nickname(), users.create_logout_url("/base/")))
    else:
        user_name = ''
    today = get_today()
    return {
            'user_name': user_name,
            'today': today,
            }
